package com.gxa.controller;


import com.gxa.service.impl.CommentsServiceImpl;
import com.gxa.utils.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "评论管理控制器")
@RequestMapping("/comment")
public class CommentsController {

    @Autowired
    private CommentsServiceImpl commentsService;

    @ApiOperation("展示所有评论管理内容")
    @GetMapping("/showCommentsByPage")
    @ResponseBody
    public ResponseData showCommentsByPage(@ApiParam(value = "显示第几页",required = true) int pageNum,@ApiParam(value = "每页显示第几条",required = true) int pageSize){

        if(commentsService.showCommentBypage(pageNum,pageSize)!=null){
            return new ResponseData(1,"显示成功",commentsService.getCount(),commentsService.showCommentBypage(pageNum, pageSize));
        }else {
            return new ResponseData(0,"显示失败");
        }
    }

}
